﻿using System;
using Csla.Serialization;
using Csla;

namespace Accounting.Library.Utility
{
    [Serializable()]
    public class K_KhoInfo : BusinessBase<K_KhoInfo>
    {
        public K_KhoInfo() {}

        public K_KhoInfo(int HangHoaId, double? SoLuong)
        {
            this.HangHoaId = HangHoaId;
            this.SoLuong = SoLuong;
        }
        public K_KhoInfo(int HangHoaId, double? SoLuong, double? DonGia, DateTime Time)
        {
            this.HangHoaId = HangHoaId;
            this.SoLuong = SoLuong;
            this.DonGia = DonGia;
            this.Time = Time;

        }
        public K_KhoInfo(int HangHoaId, double? SoLuong, double? DonGia, DateTime Time, int? ChungTuThayTheId)
        {
            this.HangHoaId = HangHoaId;
            this.SoLuong = SoLuong;
            this.DonGia = DonGia;
            this.Time = Time;
            this.ChungTuThayTheId = ChungTuThayTheId;

        }

        public K_KhoInfo(int HangHoaId, double? SoLuong, double? DonGia, DateTime Time, int? ChungTuThayTheId, int ChungTuGocId)
        {
            this.HangHoaId = HangHoaId;
            this.SoLuong = SoLuong;
            this.DonGia = DonGia;
            this.Time = Time;
            this.ChungTuGocId = ChungTuGocId;
            this.ChungTuThayTheId = ChungTuThayTheId;
        }

        public K_KhoInfo(int HangHoaId, double? SoLuong, double? DonGia)
        {
            this.HangHoaId = HangHoaId;
            this.SoLuong = SoLuong;
            this.DonGia = DonGia;
            
        }
        public K_KhoInfo(int? ChungTuThayTheId,int HangHoaId, double? DonGia)
        {
            this.HangHoaId = HangHoaId;
            this.DonGia = DonGia;
            this.ChungTuThayTheId = ChungTuThayTheId;

        }
        private static PropertyInfo<int> HangHoaIdProperty = RegisterProperty<int>(p => p.HangHoaId, "HangHoaId");
        public int HangHoaId
        {
            get { return GetProperty(HangHoaIdProperty); }
            set { SetProperty(HangHoaIdProperty, value); }
        }
        private static PropertyInfo<int> ChungTuGocIdProperty = RegisterProperty<int>(p => p.ChungTuGocId, "ChungTuGocId");
        public int ChungTuGocId
        {
            get { return GetProperty(ChungTuGocIdProperty); }
            set { SetProperty(ChungTuGocIdProperty, value); }
        }
        private static PropertyInfo<System.Nullable<double>> SoLuongProperty = RegisterProperty<System.Nullable<double>>(p => p.SoLuong, "SoLuong");
        public System.Nullable<double> SoLuong
        {
            get { return GetProperty(SoLuongProperty); }
            set { SetProperty(SoLuongProperty, value); }
        }

        private static PropertyInfo<System.Nullable<double>> DonGiaProperty = RegisterProperty<System.Nullable<double>>(p => p.DonGia, "DonGia");
        public System.Nullable<double> DonGia
        {
            get { return GetProperty(DonGiaProperty); }
            set { SetProperty(DonGiaProperty, value); }
        }

        private static PropertyInfo<System.Nullable<int>> ChungTuThayTheIdProperty = RegisterProperty<System.Nullable<int>>(p => p.ChungTuThayTheId, "ChungTuThayTheId");
        public System.Nullable<int> ChungTuThayTheId
        {
            get { return GetProperty(ChungTuThayTheIdProperty); }
            set { SetProperty(ChungTuThayTheIdProperty, value); }
        }


        private static PropertyInfo<DateTime> TimeProperty = RegisterProperty<DateTime>(p => p.Time, "Time");
        public DateTime Time
        {
            get { return GetProperty(TimeProperty); }
            set { SetProperty(TimeProperty, value); }
        }

        private static PropertyInfo<string> DienGiaỉProperty = RegisterProperty<string>(p => p.DienGiaỉ, "DienGiaỉ");
        public string DienGiaỉ
        {
            get { return GetProperty(DienGiaỉProperty); }
            set { SetProperty(DienGiaỉProperty, value); }
        }

        public static System.Collections.Generic.List<K_KhoInfo> NhapTruocXuatTruocSort(System.Collections.Generic.List<K_KhoInfo> list)
        {
            list.Sort((a, b) => a.Time.CompareTo(b.Time));
            return list;
        }

        public static System.Collections.Generic.List<K_KhoInfo> NhapSauXuatTruocSort(System.Collections.Generic.List<K_KhoInfo> list)
        {
            list.Sort((a, b) => b.Time.CompareTo(a.Time));
            return list;
        }
												
    }
}
